package cn.lhx.blog.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.lhx.blog.dao.DaoLinks;
import cn.lhx.blog.pojo.Link;
import cn.lhx.blog.service.LinksService;

@Transactional
public class LinksServiceBean implements LinksService{
@Resource(name="daoLinks")
  private DaoLinks daoLinks;

	public Link addLink(Link link) {
		daoLinks.insert(link);
		return link;
	}

	public int delLink(int id) {
	    daoLinks.delete(id);
		return id;
	}
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public List<Link> getLinks(int begin, int size) {
		List<Link> linkList=new ArrayList<Link>();
		linkList=(List<Link>) daoLinks.getList(begin, size);
		return linkList;
	}

}
